<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>西瓜后台管理</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="../../../layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../../../layuiadmin/style/admin.css" media="all">
    <link rel="stylesheet" href="../../../layuiadmin/lib/zTree/css/zTree.css" type="text/css">
    <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" type="text/css">
    <link rel="stylesheet" href="../../../layuiadmin/lib/zTree/css/awesomeStyle/awesome.css" type="text/css">
    <link rel="stylesheet" href="../../../layuiadmin/lib/zTree/css/awesomeStyle/fa.css" type="text/css">
    <script type="text/javascript" src="../../../layuiadmin/lib/zTree/js/jquery-1.4.4.min.js"></script>
    <script type="text/javascript" src="../../../layuiadmin/lib/zTree/js/jquery.ztree.core.js"></script>
    <script type="text/javascript" src="../../../layuiadmin/lib/zTree/js/jquery.ztree.excheck.js"></script>
</head>
<body>
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-block">
            <div class="layui-card-header">车辆基础信息</div>
            <div class="layui-card-body">
                <form class="layui-form layui-clear" action="">
                    <div class="layui-form-item layui-col-md6 layui-clear-none">
                        <label class="layui-form-label">车辆品牌<span class="layui-text-red">*</span> </label>
                        <div class="layui-input-inline">
                            <select name="brand">
                                <option value="">请选择品牌</option>
                                <option value="0" selected="">劳斯莱斯</option>
                                <option value="1">奔驰</option>
                                <option value="2">宝马</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-form-item layui-col-md6 layui-clear-none">
                        <label class="layui-form-label">车系<span class="layui-text-red">*</span></label>
                        <div class="layui-input-inline">
                            <select name="carSeries">
                                <option value="">请选择车系</option>
                                <option value="0" selected="">2018旗舰版</option>
                                <option value="1">奔驰</option>
                                <option value="2">宝马</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-form-item layui-col-md6 layui-clear-none">
                        <label class="layui-form-label">车型<span class="layui-text-red">*</span></label>
                        <div class="layui-input-inline">
                            <select name="carType">
                                <option value="">请选择车型</option>
                                <option value="0" selected="">2018旗舰版</option>
                                <option value="1">奔驰</option>
                                <option value="2">宝马</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-form-item layui-col-md6 layui-clear-none">
                        <label class="layui-form-label">指导价<span class="layui-text-red">*</span></label>
                        <div class="layui-input-inline">
                            <input type="text" name="guidePrice" value="12.49万元" class="layui-input layui_border_none layui-text-red" readonly>
                        </div>
                    </div>
                    <div class="layui-form-item layui-col-md6 layui-clear-none">
                        <label class="layui-form-label">采购价<span class="layui-text-red">*</span></label>
                        <div class="layui-input-inline">
                            <input type="text" name="purchasePrice" value="" placeholder="请输入采购价" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item layui-col-md6 layui-clear-none">
                        <label class="layui-form-label">批售价<span class="layui-text-red">*</span></label>
                        <div class="layui-input-inline">
                            <input type="text" name="closePrice" value="" placeholder="请输入采购价" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item layui-col-md6 layui-clear-none">
                        <label class="layui-form-label">外观颜色<span class="layui-text-red">*</span></label>
                        <div class="layui-input-inline">
                            <input type="text" name="appearance_colour" value="" placeholder="请输入外观颜色" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item layui-col-md6 layui-clear-none">
                        <label class="layui-form-label">内饰颜色<span class="layui-text-red">*</span></label>
                        <div class="layui-input-inline">
                            <input type="text" name="interior_color" value="" placeholder="请输入内饰颜色" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item layui-col-md6 layui-clear-none">
                        <label class="layui-form-label">车类<span class="layui-text-red">*</span></label>
                        <div class="layui-input-inline">
                            <select name="carCategory">
                                <option value="">请选择车类</option>
                                <option value="0" selected="">纯电动</option>
                                <option value="1">油电混合</option>
                                <option value="2">燃油</option>
                            </select>
                        </div>
                    </div>
                </form>
            </div>
        </div>
        <div class="layui-line"></div>
        <div class="layui-card-block">
            <div class="layui-card-header">经销商采购信息</div>
            <div class="layui-card-body">
                <form class="layui-form layui-clear" action="">
                    <div class="layui-form-item">
                        <label class="layui-form-label">到货周期<span class="layui-text-red">*</span></label>
                        <div class="layui-input-inline">
                            <input type="text" name="arrival_period" value="" placeholder="请输入到货周期" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">库存数量<span class="layui-text-red">*</span></label>
                        <div class="layui-input-inline">
                            <input type="text" name="quantity_in_stock" value="" placeholder="请输入库存数量" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item layui-col-md12 layui-clear-none" style="position: relative;">
                        <!--<label class="layui-form-label">销售区域<span class="layui-text-red">*</span> </label>-->
                        <!--<div class="layui-input-block">-->
                            <!--<select name="area" multiple lay-search>-->
                                <!--<option value="">请选择销售区域</option>-->
                                <!--<option value="0" selected="">上海</option>-->
                                <!--<option value="1">杭州</option>-->
                                <!--<option value="2">苏州</option>-->
                            <!--</select>-->
                        <!--</div>-->
                        <label class="layui-form-label">销售区域<span class="layui-text-red">*</span></label>
                        <div class="layui-input-inline">
                            <input id="citySel" type="text" class="layui-input" readonly value="" onclick="showMenu();" />
                        </div>
                        <div id="menuContent" class="menuContent" style="display:none; position: absolute; left: 110px!important; top: 35px!important;">
                            <ul id="treeDemo" class="ztree" style="margin-top:0; width:180px; height: 300px;"></ul>
                        </div>
                    </div>
                    <div class="layui-form-item layui-col-md12 layui-clear-none">
                        <label class="layui-form-label">物流说明</label>
                        <div class="layui-input-block">
                            <textarea name="logistics" placeholder="请输入内容" class="layui-textarea"></textarea>
                        </div>
                    </div>
                    <div class="layui-form-item layui-col-md12 layui-clear-none">
                        <label class="layui-form-label">备注</label>
                        <div class="layui-input-block">
                            <textarea name="mark" placeholder="请输入内容" class="layui-textarea"></textarea>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<script src="../../../layuiadmin/layui/layui.js"></script>
<script>
    layui.config({
        base: '../../../layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index', //主入口模块
        list: 'car_source/list', //list模块
    }).use(['index','list']);
</script>
<script type="text/javascript">
    <!--
    var setting = {
        check: {
            enable: true,
            chkboxType: { "Y" : "ps", "N" : "ps" }
        },
        view: {
            dblClickExpand: false
        },
        data: {
            simpleData: {
                enable: true
            }
        },
        callback: {
            beforeClick: beforeClick,
            onCheck: onCheck
        }
    };

    var zNodes =[
        {id:1, pId:0, name:"全国"},
        {id:2, pId:0, name:"上海"},
        {id:3, pId:0, name:"Shanghai"},
        {id:4, pId:0, name:"Hebei Province", open:true},
        {id:41, pId:4, name:"Shijiazhuang"},
        {id:42, pId:4, name:"Baoding"},
        {id:43, pId:4, name:"Handan"},
        {id:44, pId:4, name:"Chengde"},
        {id:5, pId:0, name:"Guangdong Province", open:true},
        {id:51, pId:5, name:"Guangzhou"},
        {id:52, pId:5, name:"Shenzhen"},
        {id:53, pId:5, name:"Dongguan"},
        {id:54, pId:5, name:"Fushan"},
        {id:6, pId:0, name:"Chongqing"},
        {id:6, pId:0, name:"Fujian Province", open:true},
        {id:61, pId:6, name:"Fuzhou"},
        {id:62, pId:6, name:"Xiamen"},
        {id:63, pId:6, name:"Quanzhou"},
        {id:64, pId:6, name:"Sanming"}
    ];

    function beforeClick(treeId, treeNode) {
        var zTree = $.fn.zTree.getZTreeObj("treeDemo");
        zTree.checkNode(treeNode, !treeNode.checked, null, true);
        return false;
    }

    function onCheck(e, treeId, treeNode) {
        var zTree = $.fn.zTree.getZTreeObj("treeDemo"),
            nodes = zTree.getCheckedNodes(true),
            v = "";
        for (var i=0, l=nodes.length; i<l; i++) {
            v += nodes[i].name + ",";
        }
        if (v.length > 0 ) v = v.substring(0, v.length-1);
        var cityObj = $("#citySel");
        cityObj.attr("value", v);
    }

    function showMenu() {
        var cityObj = $("#citySel");
        var cityOffset = $("#citySel").offset();
//        $("#menuContent").css({left:cityOffset.left + "px", top:cityOffset.top + cityObj.outerHeight() + "px"}).slideDown("fast");
        $("#menuContent").slideDown("fast");
        $("body").bind("mousedown", onBodyDown);
    }
    function hideMenu() {
        $("#menuContent").fadeOut("fast");
        $("body").unbind("mousedown", onBodyDown);
    }
    function onBodyDown(event) {
        if (!(event.target.id == "menuBtn" || event.target.id == "citySel" || event.target.id == "menuContent" || $(event.target).parents("#menuContent").length>0)) {
            hideMenu();
        }
    }

    $(document).ready(function(){
        $.fn.zTree.init($("#treeDemo"), setting, zNodes);
    });
    //-->
</script>
</body>
</html>